//
//  LinkAPI.swift
//  Link
//
//  Created by melvyn on 2018/11/25.
//

import Foundation
import Alamofire

public protocol LinkAPI {
    /// Perform auth view controller
    ///
    /// - Parameters:
    ///   - viewController: A view controller use to present auth view
    ///   - completionHandler: Response callback
    /// - Returns: The view that has been presented by
    func performBasicAuthLogin(_ viewController: UIViewController?, completionHandler: @escaping (Result<AuthSession>) -> Void) -> UIViewController?
 
    
    /// Perform registration view controller
    ///
    /// - Parameters:
    ///   - viewController: A view controller use to present registration view
    ///   - completionHandler: Response callback
    /// - Returns: The view that has been presented by
    func performRegistration(_ viewController: UIViewController?, completionHandler: @escaping (Result<User>) -> Void) -> UIViewController?
}

#if canImport(RxCocoa)
import RxSwift
import RxCocoa

public protocol RxLinkAPI {
    
    func performBasicAuthLogin(_ viewController: UIViewController?) -> Observable<Result<AuthSession>>
 
    
    func performRegistration(_ viewController: UIViewController?) -> Observable<Result<User>>
}
#endif
